package logic

import (
	"bluebell/dao/mysql"
	"bluebell/models"
	"errors"
	"go.uber.org/zap"
	"time"
)

func CreateComment(c *models.Comment) error {
	if c.Content == "" {
		zap.L().Error("comment content is empty")
		return errors.New("content cannot be empty")
	}
	c.CreateTime = time.Now().Unix()
	return mysql.CreateComment(c)
}

func GetCommentList(postID, page, size int64) ([]*models.Comment, error) {
	return mysql.GetCommentList(postID, page, size)
}
